package com.zyw.crawler.services;

import java.lang.reflect.Field;

public class InfoListReqDefObj {
	public String disclosureType="5";
	public String page="0";		
	public String companyCd="";
	public String isNewThree="1";	
	public String startTime="";	
	public String endTime="";	
	public String keyword="";	
	public String xxfcbj="";
	public String callback="";
	public static String generateReqUrl(Integer page,String code){
		InfoListReqDefObj obj=new InfoListReqDefObj();
		obj.setPage(Integer.toString(page));
		obj.setCompanyCd(code);
		String params="";
		for(Field f:obj.getClass().getFields()){
			String value="";
			try {
				value=f.get(obj).toString();
			} catch (IllegalArgumentException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			params+=f.getName()+"="+value+"&";
		}
		params=params.lastIndexOf("&")==params.length()-1?params.substring(0,params.length()-1):params;
		String reqUrl=CrawlerForGpgs.INFO_LIST_PAGE+"?"+params;
		return reqUrl;
	}
	public static String generateReqUrl(String code){
		InfoListReqDefObj obj=new InfoListReqDefObj();
		obj.setCompanyCd(code);
		String params="";
		for(Field f:obj.getClass().getFields()){
			String value="";
			try {
				value=f.get(obj).toString();
			} catch (IllegalArgumentException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			params+=f.getName()+"="+value+"&";
		}
		params=params.lastIndexOf("&")==params.length()-1?params.substring(0,params.length()-1):params;
		String reqUrl=CrawlerForGpgs.INFO_LIST_PAGE+"?"+params;
		return reqUrl;
	}
	public String getDisclosureType() {
		return disclosureType;
	}
	public void setDisclosureType(String disclosureType) {
		this.disclosureType = disclosureType;
	}
	public String getPage() {
		return page;
	}
	public void setPage(String page) {
		this.page = page;
	}
	public String getCompanyCd() {
		return companyCd;
	}
	public void setCompanyCd(String companyCd) {
		this.companyCd = companyCd;
	}
	public String getIsNewThree() {
		return isNewThree;
	}
	public void setIsNewThree(String isNewThree) {
		this.isNewThree = isNewThree;
	}
	public String getStartTime() {
		return startTime;
	}
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}
	public String getEndTime() {
		return endTime;
	}
	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}
	public String getKeyword() {
		return keyword;
	}
	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}
	public String getXxfcbj() {
		return xxfcbj;
	}
	public void setXxfcbj(String xxfcbj) {
		this.xxfcbj = xxfcbj;
	}
	
}
